import { MenuState } from "@/redux/interface"
import { createSlice } from "@reduxjs/toolkit"

const menuState: MenuState = {
    isCollapse: false,
    menuList: []
}

const menuSlice = createSlice({
    name: "menu",
    initialState: menuState,
    reducers: {
        updateCollapse(state: MenuState, {payload}) {
            state.isCollapse = payload
        },
        setMenuList(state: MenuState, {payload}) {
            state.menuList = payload
        }
    }
})

export const {updateCollapse, setMenuList} =  menuSlice.actions
export default menuSlice.reducer